home *** CD-ROM | disk | FTP | other *** search
- { SPX Library Version 3.0 Copyright 1993 Scott D. Ramsay }
-
- SPX_VSP unit contains majority of the sprite manipulation routines.
-
- ───────────────────────────────────────────────────────────────────────────
- function pointvsp(x,y:integer;var buff):byte;
- returns the pixel value within a sprite.
-
- x,y : offset into the sprite
-
- ───────────────────────────────────────────────────────────────────────────
- procedure psetvsp(x,y:integer;c:byte;var buff);
-
- Sets the pixel value in a sprite
-
- x,y : offset into the sprite
- c : color to place
-
- ───────────────────────────────────────────────────────────────────────────
- procedure MatteVsp(var from,too);
-
- Create a matte for a sprite file. Uses the SET thdmat to determine
- which colors will be transparent.
-
- FROM: Sprite to convert;
- TOO: Created masked sprite
-
- NOTE: The buffer "too" must be pre-allocated.
-
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fget(x1,y1,x2,y2:integer;var image);
- Grabs a sprite from the active page.
-
- X1,Y1: Coordinate one of the region;
- X2,Y2: Coordinate two of the region;
- IMAGE: Sprite to create
-
- NOTE: IMAGE must be pre-allocated
-
- ───────────────────────────────────────────────────────────────────────────
- procedure ScaleVSP(var src,dest;nx,ny:word);
-
- Stretches or shrinks a sprite to a new size.
-
- SRC: Sprite to scale;
- DEST: New sprite scaled;
- NX,NY: Width and Height of the new sprite
-
- NOTE: DEST must be preallocated.
-
- EXAMPLE:
-
- var
- MySprite,
- NewSize : pointer;
-
- .
- .
- .
- getmem(NewSize,buffsize(16,16));
- ScaleVSP(MySprite^,NewSize^,16,16); { Changes MySprite to be size 16x16 }
-
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fput(x1,y1:integer;var image;center:boolean);
-
- Displays a sprite on the active page.
-
- X1,Y1: Coordinate to place top-left of sprite. If CENTER is TRUE
- X1,Y1 is the coordinate of the center of the sprite;
- IMAGE: Sprite;
- CENTER: Set to TRUE to display sprite centered on X1,Y1
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fput_clip(x,y:integer;var buff;center:boolean);
-
- Displays a sprite on the active page. Clips the sprite according
- to WinMinX, WinMinY, WinMaxX, WinMaxY.
-
- X,Y: Coordinate to place top-left of sprite. If CENTER is TRUE
- X,Y is the coordinate of the center of the sprite;
- buff: Sprite;
- CENTER: Set to TRUE to display sprite centered on X,Y
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fput_mask(x1,y1:integer;var image;rmw:byte);
-
- Displays a sprite on the active page.
-
- X1,Y1: Coordinate to place top-left of sprite.
- IMAGE: Sprite;
- RMW: Type of display method
-
- CopyPut : Use normal copy. (fput recommened instead)
- XORPut : XOR the sprite with the active display
- OrPut : OR the sprite with the active display
- AndPut : AND the sprite with the active display
-
- ───────────────────────────────────────────────────────────────────────────
- procedure ftput(x,y:integer;var buff;center:boolean);
-
- Displays a sprite on the active page with color 0 as a transparent
- color. Does NOT preform any clipping.
-
- X,Y: Coordinate to display top-left of sprite. If CENTER is TRUE
- X,Y is the coordinate of the center of the sprite;
- BUFF: Sprite;
- CENTER: Set to TRUE to display sprite centered on X,Y
-
- ───────────────────────────────────────────────────────────────────────────
- procedure ftput_clip(x,y:integer;var buff;center:boolean);
-
- Displays a sprite on the active page with color 0 as a transparent
- color. Clips the sprite according to WinMinX, WinMinY, WinMaxX, WinMaxY.
-
- X,Y: Coordinate to place top-left of sprite. If CENTER is TRUE
- X,Y is the coordinate of the center of the sprite;
- BUFF: Sprite;
- CENTER: Set to TRUE to display sprite centered on X,Y
-
-
- ───────────────────────────────────────────────────────────────────────────
- procedure ftput_clip_mask(x,y:integer;var buff;center:boolean;var virt);
-
- Displays a sprite on the active page with color 0 as a transparent
- color. Clips the sprite according to WinMinX, WinMinY, WinMaxX, WinMaxY.
- also checks the 320x200 virtual page as a mask.
-
- For this function to draw a pixel from a sprite the following must be true:
-
- sprite pixel must be non-zero
- pixel must be in the bounds of the clipped region
- the correspoding coordinate on the virtual page must be non-zero
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fctput_clip(x,y:integer;var buff;center:boolean;color:byte);
-
- Displays a sprite on the active page with color 0 as a transparent
- color. Clips the sprite according to WinMinX, WinMinY, WinMaxX, WinMaxY.
- Displays all non-zero pixels to (color).
-
- ───────────────────────────────────────────────────────────────────────────
- procedure fxtput_clip(x,y:integer;var buff;center:boolean;var table);
-
- Displays a sprite on the active page with color 0 as a transparent
- color. Clips the sprite according to WinMinX, WinMinY, WinMaxX, WinMaxY.
- Using a look up table for the sprite.
-
- table: must be of size 256 bytes: { array[0..255] of byte }
-
- The sprite pixel color becomes an index to the table. The value in the
- table becomes the color displayed.
-
- e.g.
-
- var
- i : integer;
- table : array[0..255] of byte;
- begin
- for i := 0 to 255 do
- table[i] := i;
- table[40] := 2;
-
- fxtput_clip(100,100,sprite^,true,table);
- end;
-
- The above example will display the sprite centered at (100,100).
- All the colors of the sprite will be the same except for color 40
- will be displayed as color 2.
-
- ───────────────────────────────────────────────────────────────────────────
- procedure displayer(x,y:integer;var pic,virt;plv:byte);
-
- Displays a Sprite (pic) on the current page. Based on the sprite's level
- (plv). The (virt) is the virtual page that keeps track of all of the
- sprites currently on the screen.
-
- Think of the display having 256 layers. Layer 0 is furthest back and
- layer 255 is the top layer. For example, a sprite "Displayer" with
- plv=4 will only overwrite sprites that have been written with a plv
- value less than 4. Sprites greater than 4 will be unaffected.
-
- The how DispLayer works:
- Functions the same as ftput, except that it also checks the
- screen location on the "virt" page. If that pixel value is less
- than the "plv" value, then the pixel is drawn.
-
- Use the "DispLayer" function with DispVirt to update the virtual page.
-
-
- X,Y: Top-left position of sprite;
- PIC: Sprite to display;
- VIRT: Virtual page for sprite levels;
- PLV: Sprite level value
-
- ───────────────────────────────────────────────────────────────────────────
- procedure eraselayer(x,y:integer;bkpage:byte;var pic,virt;plv:byte);
-
- Erases a sprite on the current page.
-
- X,Y: Coordinates to place the sprite;
- BKPAGE: Backgroun page to write to the current screen;
- PIC: Sprite to erase;
- VIRT: Virtual page for sprite levels;
- PLV: Sprite level value
-
- Erases each sprite pixel when the byte on the (virt) page is
- less than or equal to (plv).
-
- ───────────────────────────────────────────────────────────────────────────
- procedure dispvirt(x,y:integer;var pic,virt;plv:byte);
-
- Updates the virtual page with the sprite level value.
-
- X,Y: Coordinates of the sprite;
- PIC: Sprite to update;
- VIRT: Virtual page to be updated;
- PLV: Sprite level value
-
- ───────────────────────────────────────────────────────────────────────────
- procedure displayer_clip(x,y:integer;var pic,virt;plv:byte);
-
- Same as the procedure displayer but clips according to
- WinMinX, WinMinY, WinMaxX, WinMaxY.
-
- ───────────────────────────────────────────────────────────────────────────
- procedure dispvirt_clip(x,y:integer;var pic,virt;plv:byte);
-
- Same as the procedure dispvirt but clips according to
- WinMinX, WinMinY, WinMaxX, WinMaxY.
-
- ───────────────────────────────────────────────────────────────────────────
- procedure erasevirt(x,y:integer;var pic,virt;plv:byte);
-
- Erases the virtual page with the sprite level value.
-
- X,Y: Coordinates of the sprite;
- PIC: Sprite to update;
- VIRT: Virtual page to be erased;
- PLV: Sprite level value
-
-
- ───────────────────────────────────────────────────────────────────────────
- procedure copyvirt(x,y:integer;var pic,v1,v2;plv:byte);
-
- Copies a virtual area to another virtual page
-
- X,Y: Coordinates of the sprite;
- PIC: Sprite to update;
- V1: Virtual page source;
- V1: Virtual page destination;
- PLV: Sprite level value
- ───────────────────────────────────────────────────────────────────────────
-
-